Unify uboot and syslinux test cases
authorColin Walters <walters@verbum.org>
Wed, 15 Jan 2014 14:48:04 +0000 (09:48 -0500)
committerColin Walters <walters@verbum.org>
Wed, 15 Jan 2014 14:48:04 +0000 (09:48 -0500)
The test-admin-deploy-1 was copied into -uboot at some point.  But
really they should be testing exactly the same thing, except for
the bootloader backend.

Unify these tests by extracting a common test core.

Makefile-tests.am
tests/admin-test.sh [new file with mode: 0755]
tests/test-admin-deploy-1.sh [deleted file]
tests/test-admin-deploy-syslinux.sh [new file with mode: 0755]
tests/test-admin-deploy-uboot.sh

index 87ae8d0514010427ec11daf17824c94bff79dbef..3c155ecb0e6506a0406f74f4da037ca6ccbc44b6 100644 (file)
@@ -32,7 +32,7 @@ testfiles = test-basic \
        test-pull-corruption \
        test-pull-resume \
        test-gpg-signed-commit \
-       test-admin-deploy-1 \
+       test-admin-deploy-syslinux \
        test-admin-deploy-2 \
        test-admin-deploy-karg \
        test-admin-deploy-etcmerge-cornercases \
@@ -48,6 +48,7 @@ testmeta_DATA = $(testfiles:=.test)
 insttest_DATA = tests/archive-test.sh \
        tests/pull-test.sh \
        tests/libtest.sh \
+       tests/admin-test.sh \
        $(NULL)
 
 gpginsttestdir = $(pkglibexecdir)/installed-tests/gpghome
diff --git a/tests/admin-test.sh b/tests/admin-test.sh
new file mode 100755 (executable)
index 0000000..8520b88
--- /dev/null
@@ -0,0 +1,156 @@
+#!/bin/bash
+#
+# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+echo "1..9"
+
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+export rev
+# This initial deployment gets kicked off with some kernel arguments 
+ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot status
+
+echo "ok deploy command"
+
+assert_not_has_dir sysroot/boot/loader.0
+assert_has_dir sysroot/boot/loader.1
+assert_has_dir sysroot/ostree/boot.1.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO'
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* quiet'
+assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
+
+echo "ok layout"
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+# Need a new bootversion, sine we now have two deployments
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+assert_has_dir sysroot/ostree/boot.0.1
+assert_not_has_dir sysroot/ostree/boot.0.0
+assert_not_has_dir sysroot/ostree/boot.1.0
+assert_not_has_dir sysroot/ostree/boot.1.1
+# Ensure we propagated kernel arguments from previous deployment
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
+
+echo "ok second deploy"
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+# Keep the same bootversion
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+# But swap subbootversion
+assert_has_dir sysroot/ostree/boot.0.0
+assert_not_has_dir sysroot/ostree/boot.0.1
+ostree admin --sysroot=sysroot status
+
+echo "ok third deploy (swap)"
+
+ostree admin --sysroot=sysroot os-init otheros
+
+ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
+assert_not_has_dir sysroot/boot/loader.0
+assert_has_dir sysroot/boot/loader.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-1.conf
+assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
+
+echo "ok independent deploy"
+
+ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
+assert_has_file sysroot/boot/loader/entries/ostree-testos-2.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
+
+echo "ok fourth deploy (retain)"
+
+echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file
+rm -r  sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory
+rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
+ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
+ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
+linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
+test "${linktarget}" = /ENOENT
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
+assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
+ostree admin --sysroot=sysroot status
+
+echo "ok deploy with modified /etc"
+
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
+export newrev
+assert_not_streq ${rev} ${newrev}
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+# New files in /usr/etc
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
+# And persist /etc changes from before
+assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
+ostree admin --sysroot=sysroot status
+
+echo "ok upgrade bare"
+
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot upgrade --os=testos
+origrev=${rev}
+rev=${newrev}
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+assert_not_streq ${rev} ${newrev}
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
+
+echo "ok upgrade"
+
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot undeploy 1
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
+
+ostree admin --sysroot=sysroot undeploy 0
+assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${newrev}.0
+ostree admin --sysroot=sysroot status
+
+echo "ok undeploy"
+
+if ostree admin --sysroot=sysroot deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then
+    assert_not_reached "Unexpected successful deploy of unknown OS"
+fi
+echo "ok deploy with unknown OS"
diff --git a/tests/test-admin-deploy-1.sh b/tests/test-admin-deploy-1.sh
deleted file mode 100755 (executable)
index c1151d1..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo "1..1"
-
-setup_os_repository "archive-z2" "syslinux"
-
-echo "ok setup"
-
-echo "1..9"
-
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-export rev
-# This initial deployment gets kicked off with some kernel arguments 
-ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
-ostree admin --sysroot=sysroot status
-
-echo "ok deploy command"
-
-assert_not_has_dir sysroot/boot/loader.0
-assert_has_dir sysroot/boot/loader.1
-assert_has_dir sysroot/ostree/boot.1.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO'
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* quiet'
-assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot status
-
-echo "ok layout"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Need a new bootversion, sine we now have two deployments
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_dir sysroot/ostree/boot.0.1
-assert_not_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.1.0
-assert_not_has_dir sysroot/ostree/boot.1.1
-# Ensure we propagated kernel arguments from previous deployment
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot status
-
-echo "ok second deploy"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Keep the same bootversion
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-# But swap subbootversion
-assert_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.0.1
-ostree admin --sysroot=sysroot status
-
-echo "ok third deploy (swap)"
-
-ostree admin --sysroot=sysroot os-init otheros
-
-ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
-assert_not_has_dir sysroot/boot/loader.0
-assert_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-1.conf
-assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot status
-
-echo "ok independent deploy"
-
-ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
-assert_has_file sysroot/boot/loader/entries/ostree-testos-2.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot status
-
-echo "ok fourth deploy (retain)"
-
-echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file
-rm -r  sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory
-rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
-ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
-ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
-linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
-test "${linktarget}" = /ENOENT
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
-assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
-ostree admin --sysroot=sysroot status
-
-echo "ok deploy with modified /etc"
-
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
-export newrev
-assert_not_streq ${rev} ${newrev}
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-# New files in /usr/etc
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
-# And persist /etc changes from before
-assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
-ostree admin --sysroot=sysroot status
-
-echo "ok upgrade bare"
-
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
-ostree admin --sysroot=sysroot upgrade --os=testos
-origrev=${rev}
-rev=${newrev}
-newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-assert_not_streq ${rev} ${newrev}
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot status
-
-echo "ok upgrade"
-
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-ostree admin --sysroot=sysroot undeploy 1
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0
-
-ostree admin --sysroot=sysroot undeploy 0
-assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${newrev}.0
-ostree admin --sysroot=sysroot status
-
-echo "ok undeploy"
-
-if ostree admin --sysroot=sysroot deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then
-    assert_not_reached "Unexpected successful deploy of unknown OS"
-fi
-echo "ok deploy with unknown OS"
diff --git a/tests/test-admin-deploy-syslinux.sh b/tests/test-admin-deploy-syslinux.sh
new file mode 100755 (executable)
index 0000000..76161bc
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo "1..1"
+
+setup_os_repository "archive-z2" "syslinux"
+
+echo "ok setup"
+
+. $(dirname $0)/admin-test.sh
index e24901082f423ac7fd830852f1f4d3f489e69300..11dee585ef077a0d89be99d036ab7322b4d1b7fe 100755 (executable)
@@ -1,9 +1,8 @@
 #!/bin/bash
 #
+# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
 # Copyright (C) 2013 Javier Martinez <javier.martinez@collabora.co.uk>
 #
-# Based on tests/test-admin-deploy-1.sh by Colin Walters.
-#
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
@@ -29,105 +28,4 @@ setup_os_repository "archive-z2" "uboot"
 
 echo "ok setup"
 
-echo "1..2"
-
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-export rev
-# This initial deployment gets kicked off with some kernel arguments
-ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=console=ttySO,115200n8 --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
-
-echo "ok deploy command"
-
-assert_not_has_dir sysroot/boot/loader.0
-# Ensure uEnv.txt exists and has proper values
-assert_has_file sysroot/boot/loader.1/uEnv.txt
-linux=$(grep linux sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-initrd=$(grep initrd sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4)
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "kernel_image=$linux"
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "ramdisk_image=$initrd"
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "bootargs=$options"
-
-echo "ok U-Boot"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Need a new bootversion, sine we now have two deployments
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_dir sysroot/ostree/boot.0.1
-assert_not_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.1.0
-assert_not_has_dir sysroot/ostree/boot.1.1
-# Ensure we propagated kernel arguments from previous deployment
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO console=ttySO,115200n8'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-# Ensure uEnv.txt has proper values
-assert_has_file sysroot/boot/loader.0/uEnv.txt
-linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4)
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options"
-
-ostree admin --sysroot=sysroot status
-
-echo "ok second deploy"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Keep the same bootversion
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-# But swap subbootversion
-assert_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.0.1
-# Ensure uEnv.txt has proper values
-assert_has_file sysroot/boot/loader.0/uEnv.txt
-linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4)
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options"
-
-echo "ok third deploy (swap)"
-
-ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
-assert_not_has_dir sysroot/boot/loader.0
-assert_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-1.conf
-assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-# Ensure uEnv.txt has proper values
-assert_has_file sysroot/boot/loader.1/uEnv.txt
-linux=$(grep linux sysroot/boot/loader.1/entries/ostree-otheros-0.conf | cut -d ' ' -f 2)
-initrd=$(grep initrd sysroot/boot/loader.1/entries/ostree-otheros-0.conf | cut -d ' ' -f 2)
-options=$(grep options sysroot/boot/loader/entries/ostree-otheros-0.conf | cut -d ' ' -f 2-4)
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "kernel_image=$linux"
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "ramdisk_image=$initrd"
-assert_file_has_content sysroot/boot/loader.1/uEnv.txt "bootargs=$options"
-
-echo "ok independent deploy"
-
-ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
-assert_has_file sysroot/boot/loader/entries/ostree-testos-2.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
-# Ensure uEnv.txt has proper values
-assert_has_file sysroot/boot/loader.0/uEnv.txt
-linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2)
-options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4)
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd"
-assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options"
-
-echo "ok fourth deploy (retain)"
-
+. $(dirname $0)/admin-test.sh